/// Show the usage of Class Url

#include "Url.hpp"

#include <iostream>

using namespace std;

void
Usage(char* arg)
{
    cout << "Usage : " << arg << " url" << endl;
    exit(-1);
}

int
main(int argc, char** argv)
{
    if (argc < 2) {
        Usage(argv[0]);
    }

    string url = argv[1];
    Url url_handle;
    if (url_handle.ParseUrl(url)) {
        cout << "Parse url : " << url << endl
             << "  Host :" << url_handle.mHost << endl
             << "  Path :" << url_handle.mPath << endl
             << "  IP   :" << "will resolve later" << endl
             << "  Port :" << url_handle.mPort << endl;
    } else {
        cout << "Invalid url : " << url << endl;
    }
}
